package com.zst.demo2.service.impl;

import com.zsr.entities.UserDTO;
import com.zst.demo2.converter.UserConverter;
import com.zst.demo2.mapper.UserMapper;
import com.zst.demo2.po.UserPO;
import com.zst.demo2.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * 用户信息操作
 */
@Service
@Slf4j
public class UserServiceImpl implements IUserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public Optional<UserDTO> getUserById(Long id) {
        UserPO userPO = userMapper.selectById(id);
        return Optional.of(UserConverter.convert2UserDTO(userPO));
    }
}
